<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/12/19/019
 * Time: 17:00
 */

namespace Gate\controller;

use GatewayWorker\Gateway;
class TpGateWayController
{
    public $objGate; //gateway实例对象

    public function __construct()
    {
        // gateway 进程 在这里配置 gateway
        $this->objGate = new Gateway("Websocket://0.0.0.0:7272");
        // 设置名称，方便status时查看
        $this->objGate ->name = 'ChatGateway';
        // 设置进程数，gateway进程数建议与cpu核数相同
        $this->objGate ->count = 1;
        // 分布式部署时请设置成内网ip（非127.0.0.1）
        $this->objGate ->lanIp = '127.0.0.1';
        // 内部通讯起始端口，假如$gateway->count=4，起始端口为4000
        // 则一般会使用4000 4001 4002 4003 4个端口作为内部通讯端口
        $this->objGate ->startPort = 2300;
        // 心跳间隔
        $this->objGate ->pingInterval = 10;
        // 心跳数据
        $this->objGate ->pingData = '{"type":"ping"}';
        // 服务注册地址
        $this->objGate ->registerAddress = '127.0.0.1:1236';
    }

}